import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import cheerio from 'cheerio'

Vue.config.productionTip = false

// new Vue({
//   router,
//   store,
//   render: h => h(App)
// }).$mount('#app')

import MicServer from '../../single-spa/index'
// 安装微服务
MicServer.getInstance({
  _axios: axios,
  _vue: Vue,
  _cheerio: cheerio
}).then((mic) => {
  Vue.prototype.micServer = mic
  console.log('app2 getInstance then', mic)
  mic.registerApp({
    el: 'app2',
    name: 'app2',
    app: {
      router,
      store,
      render: (h) => h(App)
    }
  })
  // 开启 app2
  mic.startApp({
    name: 'app2'
  }).then((res) => {
    // 加载项目，添加蒙版
    console.log('主项目 app2 挂在成功，期望结果是界面显示主项目，成功的Vue实例是：', res)
  })
}).catch((err) => {
  console.log(err)
})
